/*
 ============================================================================
 Name		: TradeFundQueryFunds.h
 Author	  : Zhang Jiawei
 Version	 : 1.0
 Copyright   : Your copyright notice
 Description : CTradeFundQueryFunds declaration
 ============================================================================
 */

#ifndef TRADEFUNDQUERYFUNDS_H
#define TRADEFUNDQUERYFUNDS_H

// INCLUDES
#include "TradeBlock.h"
#include "Control.h"
#include "TableWidget.h"
#include "TradeBlockNetwork.h"

// CLASS DECLARATION

class CTradeFundQueryVolume: public CTradeBlock, public MWidgetObserver, public MPushButtonObserver//,public MReqObserver
{
public:
    ~CTradeFundQueryVolume();

    static CTradeFundQueryVolume* NewL(CBaseBlock* bsBack = NULL);

    static CTradeFundQueryVolume* NewLC(CBaseBlock* bsBack);

private:
    CTradeFundQueryVolume(CBaseBlock* bsBack);

    void ConstructL();

public:
    void OnDraw(CFbsBitGc& g) const;

    void OnKeyDown(TInt keyCode);
    
    void OnMouseDown(const TPoint& aPt);
    
    void OnMouseMove(const TPoint& aPt);

    void OnMouseUp(const TPoint& aPt);

    void SizeChanged();    
    
    void ChangeFocus(TBool aFoucs, const TInt& keyCode);
    
protected:
    void AddTabs();

    void BeforeDraw(CFbsBitGc& g) const;
    
private:
    void CreateTable();
    void CreateControls();
    void LayoutControls();
    
    void InitNetworkData();
    
public:
	void PushButtonClicked();
	
public:
    // from MWidgetObserver
    void UpdateScreen();
    
    void SelectOneRow(TInt aRowIndex);
    
    void LoseFocus(const TInt& keycode);
    
public:
	TBool ProcessTradeNetworkMsg(TInt nError, TAny* p, const TDesC8& aBodyData);
	//TBool UpdateTradeNetwork(TInt nProgress);
	
public:
	TBool AppendNetworkData(p_ofhold_record_info_t pArray);
	
private:
    enum TFundQueryVolumeContorl
    {
    	EFundQueryVolumeContorl_Transfer,
    	EFundQueryVolumeContorl_Ransom,
    	EFundQueryVolumeContorl_Divideneds,
    	EFundQueryVolumeContorl_More,
    	EFundQueryVolumeContorlCount
    };
    enum TNetworkStatus
    {
    	ENetworkStatus_None,
    	ENetworkStatus_Req,
    	ENetworkStatus_Resp,
    };
    
private:
    CTableWidget*	iTable;
    
    CPushButton* 	iButtonTransfer;
    CPushButton* 	iButtonRansom;
    CPushButton* 	iButtonDividends;
    CPushButton* 	iButtonMore;
    
    CControl*		iControls[EFundQueryVolumeContorlCount];
    TInt			iFocusControl;
    
    TInt			iNetworkStatus;
    
    TInt			iNumberOfElement;
    TBool			iCanReq;
};

#endif // TRADEBLOCKQUERYFUNDS_H
